<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			class Father
			{
				constructor(x,y)
				{
					this.x=x;
					this.y=y;
				}
				sum()
				{
					console.log(this.x+this.y);
				}
			}
			class Son extends Father
			{
				constructor(x,y)
				{   
					super(x,y);  //super必须在子类this之前调用
			
				}
				subtract()
				{
					console.log(this.x-this.y);  //为什么继承了然后不写super这个就用不了了
				}
			}
			 var son1=new Son(5,3);
			 son1.subtract();
			 son1.sum();
		</script>
	</head>
	<body>
	</body>
</html>